package com.lbl.flowabledemo02.Configuration;

import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.RepositoryService;
import org.flowable.image.ProcessDiagramGenerator;

public class FlowableEngineConfigurationExample {

    private static ProcessEngine processEngine;

    public static RepositoryService getRepositoryService() {
        if (processEngine == null) {
            initProcessEngine();
        }
        return processEngine.getRepositoryService();
    }

    public static ProcessDiagramGenerator getProcessDiagramGenerator() {
        // 根据你的实际情况返回 ProcessDiagramGenerator 的实例
        // 例如，如果你使用的是默认的 Flowable 实现，可以这样获取
        return processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator();
    }

    private static void initProcessEngine() {
        // 这里根据你的 Flowable 配置方式进行初始化
        // 以下是一个基于内存数据库的简单示例配置
        processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
                .buildProcessEngine();
    }
}